package com.zqwm.fly.service;

import com.zqwm.fly.mapper.ArticleMapper;
import com.zqwm.fly.model.Article;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ArticleService extends BaseService<ArticleMapper,Article>
{
    @Autowired
    public ArticleMapper articleMapper;

    //添加文章点击量
    @Async
    public void setLookSum(Article article)
    {
        Article art = new Article();
        art.setLooksum(article.getLooksum()+1);
        art.setId(article.getId());
        dao.update(art);
    }

    //热门总排行
    public List<Article> topArticle(Map<String,Object>map)
    {
        return articleMapper.topArticle(map);
    }

    //按标签分类
    public List<Article>getLabel()
    {
        return articleMapper.getLabel();
    }
}
